//
//  JCMainCollectionViewCell.m
//  ABookOfCartoon
//
//  Created by dlios on 15-5-14.
//  Copyright (c) 2015年 Power Of Ants. All rights reserved.
//

#import "JCMainCollectionViewCell.h"
#import "UIImageView+WebCache.h"

@interface JCMainCollectionViewCell()
@property (nonatomic, retain)UIImageView *pic;
@property (nonatomic, retain)UILabel *car;

@end

@implementation JCMainCollectionViewCell

- (void)dealloc
{
    [_car release];
    [_pic release];
    [super dealloc];
}
- (instancetype) initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {

        self.pic = [[UIImageView alloc] init];
        [self.contentView addSubview:_pic];
        [_pic release];
        //加分类名
        self.car = [[UILabel alloc] init];
        [self.contentView addSubview:_car];
        [_car release];
    }
    return self;
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    _pic.frame = CGRectMake(0, 0, self.contentView.bounds.size.width, self.contentView.bounds.size.height - 30);
    _car.frame = CGRectMake(0, self.pic.frame.size.height, self.contentView.bounds.size.width, 30);
    _car.textAlignment = UITextAlignmentCenter;
    
    
}
- (void)setModel:(JCMainPageModel *)model
{
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
    //    [_picOfCata sd_setImageWithURL:[NSURL URLWithString:model.pic]];
    [_pic sd_setImageWithURL:[NSURL URLWithString:model.BookIconOtherURL]placeholderImage:[UIImage imageNamed:@"/Users/dlios/ABookOfCartoon/ABookOfCartoon/9.jpg"]];
    _car.text = model.BookName;
}




@end
